package com.yz10000rmb.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;

import com.yz10000rmb.entity.JoinUsMenu;
import com.yz10000rmb.entity.JoinUsRegime;
import com.yz10000rmb.service.joinus.JoinUsRegimeService;
import com.yz10000rmb.service.joinus.JoinUsService;

@Controller
public class JoinUsController implements BaseController {
	
	private static final String FINDJOINUSSUCCESS = "findJoinUsSuccess";
		
	private JoinUsMenu joinUsMenu;

	private List<JoinUsMenu> joinUsMenus = new ArrayList<JoinUsMenu>();
	
	private static JoinUsService joinUsService;
	
	private static ApplicationContext ac;
	
	private Integer menuId ;
	
	private JoinUsRegime joinUsRegime;

	private List<JoinUsRegime> joinUsRegimes = new ArrayList<JoinUsRegime>();
	
	private static JoinUsRegimeService joinUsRegimeService;
	
	
	static {
		ac = new ClassPathXmlApplicationContext("applicationContext.xml");
		joinUsService = (JoinUsService) ac.getBean("joinUsService");
		joinUsRegimeService = (JoinUsRegimeService) ac.getBean("joinUsRegimeService");
	}
	
	public String findByMenuId(){
		this.joinUsMenus = joinUsService.findAllJoinUsMenus();
		this.joinUsRegimes = joinUsRegimeService.findByJoinUsMenuId(menuId);
		return FINDJOINUSSUCCESS;
	}

	public JoinUsMenu getJoinUsMenu() {
		return joinUsMenu;
	}

	public void setJoinUsMenu(JoinUsMenu joinUsMenu) {
		this.joinUsMenu = joinUsMenu;
	}

	public List<JoinUsMenu> getJoinUsMenus() {
		return joinUsMenus;
	}

	public void setJoinUsMenus(List<JoinUsMenu> joinUsMenus) {
		this.joinUsMenus = joinUsMenus;
	}

	public Integer getMenuId() {
		return menuId;
	}

	public void setMenuId(Integer menuId) {
		this.menuId = menuId;
	}

	public JoinUsRegime getJoinUsRegime() {
		return joinUsRegime;
	}

	public void setJoinUsRegime(JoinUsRegime joinUsRegime) {
		this.joinUsRegime = joinUsRegime;
	}

	public List<JoinUsRegime> getJoinUsRegimes() {
		return joinUsRegimes;
	}

	public void setJoinUsRegimes(List<JoinUsRegime> joinUsRegimes) {
		this.joinUsRegimes = joinUsRegimes;
	}
	

}
